home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok20.lha
/
ComplexLib
/
txt
/
FFPMathLibExt.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
2KB
|
85 lines
(*********************************************************************
:Program. FFPMathLibExt.mod
:Author. Gary Struhlik
:Address. -
:Phone. -
:shortcut. [gs]
:Version. 1.0
:Date. 06.10.1988
:Copyright. PD
:Language. Modula-II
:Translator. M2Amiga
:Imports. -
:UpDate. -
:Contents. Zusätzliche mathematische Funktionen
:Remark. Für den Amiga Modula-2 Klub / Stuttgart
:Remark. Am 01.01.1989 mit M2Amiga 3.2d neu kompiliert
**********************************************************************)
IMPLEMENTATION MODULE FFPMathLibExt; (* für Datentyp FFP *)
FROM MathTrans IMPORT Sin,Cos,Log,Exp,Sqrt,Atan;
FROM SYSTEM IMPORT FFP;
PROCEDURE Round ( x : FFP ) : LONGINT;
BEGIN
IF x >= 0.0 THEN RETURN TRUNC( x + 0.5 )
ELSE RETURN TRUNC( x - 0.5 )
END (* IF *)
END Round;
PROCEDURE Sqr ( x : FFP ) : FFP;
BEGIN
RETURN x*x
END Sqr;
PROCEDURE Arsinh ( x : FFP ) : FFP;
BEGIN
RETURN Log( x + Sqrt( x*x + 1.0))
END Arsinh;
PROCEDURE Arcosh ( x : FFP ) : FFP;
BEGIN
IF (x > 1.0) THEN RETURN Log( x + Sqrt( x*x - 1.0)) (* für x # 1.0 *)
ELSIF x=1.0 THEN RETURN 0.0
END (* IF *)
END Arcosh;
PROCEDURE Artanh ( x : FFP ) : FFP;
BEGIN
RETURN 0.5*Log( (1.0+x)/(1.0-x) ) (* für x # 1.0 *)
END Artanh;
PROCEDURE Fact ( x : FFP ) : FFP; (* Fakultät *)
VAR
i : INTEGER;
fac : FFP;
BEGIN
fac:=1.0;
IF (x = 1.0) OR (x = 0.0) THEN
RETURN 1.0
ELSIF x < 0.0 THEN
RETURN 1.0E-38
ELSE
FOR i:=2 TO TRUNC(x) DO
fac:=fac+fac*( FFP(i)-1.0 )
END; (* FOR *)
RETURN fac
END
END Fact;
PROCEDURE Sgn ( x : FFP ) : FFP; (* Vorzeichen -1.0, 0.0 oder +1.0 *)
BEGIN
IF x = 0.0 THEN
RETURN 0.0
ELSE
RETURN x/ABS(x)
END (* IF *)
END Sgn;
END FFPMathLibExt.